//
//  TCShopMapTableViewCell.m
//  Project_B
//
//  Created by dllo on 15/12/1.
//  Copyright © 2015年 张闯. All rights reserved.
//

#import "TCShopMapTableViewCell.h"
#import "UIImageView+WebCache.h"
#define WIDTH [[UIScreen mainScreen] bounds].size.width / 375
#define HEIGHT [[UIScreen mainScreen] bounds].size.height / 667
@interface TCShopMapTableViewCell ()
@property (nonatomic, strong)UIImageView *ImageView;
@property (nonatomic, strong)UILabel *titlelabel;
@property (nonatomic, strong)UILabel *addresslabel;
@property (nonatomic, strong)UIImageView *mapView;
@end

@implementation TCShopMapTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.ImageView = [[UIImageView alloc]init];
        self.ImageView.layer.borderWidth = 1;
        self.ImageView.layer.borderColor = [UIColor colorWithRed:60.0 / 255 green:149.0 / 255 blue:58.0 / 255 alpha:1].CGColor;
        [self.contentView addSubview:self.ImageView];
        self.titlelabel = [[UILabel alloc]init];
        self.titlelabel.numberOfLines = 0;
        [self.titlelabel setFont:[UIFont systemFontOfSize:14]];
        [self.contentView addSubview:self.titlelabel];
        
        self.addresslabel = [[UILabel alloc]init];
        self.addresslabel.textColor = [UIColor grayColor];
        [self.addresslabel setFont:[UIFont systemFontOfSize:13]];
        self.addresslabel.numberOfLines = 0;
        [self.contentView addSubview:self.addresslabel];
        
        self.mapView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.mapView];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.ImageView.frame = CGRectMake(5*WIDTH, 5*HEIGHT, 150*WIDTH, 120*HEIGHT);
    self.titlelabel.frame = CGRectMake(160*WIDTH, 5*HEIGHT, 200*WIDTH, 40*HEIGHT);
    self.addresslabel.frame = CGRectMake(160*WIDTH, 47*HEIGHT, 200*WIDTH, 50*HEIGHT);
    self.mapView.frame = CGRectMake(340*WIDTH, 100*HEIGHT, 20*WIDTH, 20*HEIGHT);
}
- (void)setDic:(NSDictionary *)dic
{
    if (_dic != dic) {
        _dic = dic;
    }
    [self.ImageView sd_setImageWithURL:[NSURL URLWithString:dic[@"img"]] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.titlelabel.text = dic[@"title"];
    self.addresslabel.text = dic[@"product"];
    [self.mapView setImage:[UIImage imageNamed:@"iconfont-zuobiao"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
